package com.icinfo.cloud.provider.peripheralinterface.zszf.controller;

import com.icinfo.cloud.provider.peripheralinterface.zszf.dto.*;
import com.icinfo.cloud.provider.peripheralinterface.zszf.service.IHandLawIInterfaceService;
import com.icinfo.cloud.provider.peripheralinterface.zszf.vo.WaitApprovalBasicInfoVo;
import com.icinfo.cloud.provider.peripheralinterface.zszf.vo.WaitApprovalRecordVo;
import com.icinfo.cloud.provider.punish.approval.vo.AuditInfoListVo;
import com.icinfo.cloud.provider.punish.config.dto.ConfigDictionaryInfoQueryDto;
import com.icinfo.cloud.provider.punish.config.vo.ConfigDictionaryInfoVo;
import com.icinfo.cloud.provider.punish.service.IConfigDictionaryInfoService;
import com.icinfo.cloud.provider.punish.ucase.urge.dto.CaseUrgeDetailDto;
import com.icinfo.cloud.provider.punish.ucase.urge.dto.CaseUrgePageRequest;
import com.icinfo.cloud.provider.punish.ucase.urge.dto.CaseUrgePageResponse;
import com.icinfo.framework.common.web.Result;
import com.icinfo.cloud.provider.common.page.PageResponse;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 描述：掌上执法接口前端控制器
 *
 * @author shishengyao
 * @description
 * @date 2023/4/18
 */
@RestController
@RefreshScope
@RequestMapping("/peripheralInterface/zszf")
@Slf4j
public class HandLawInterfaceController {
    @Resource
    private IHandLawIInterfaceService zszfInterfaceService;
    @Resource
    private IConfigDictionaryInfoService configDictionaryInfoService;

    /**
     * 【V1.11.4】描述：获取待审批总数基础信息
     *
     * @param queryDto 查询dto
     * @return {@link Result<WaitApprovalBasicInfoVo> }
     * @author shishengyao
     * @date 2023/04/18
     */
    @PostMapping("/getWaitApprovalBasicInfo")
    @ApiOperation(value = "【V1.11.4】描述：获取待审批基础信息", httpMethod = "POST")
    public Result<WaitApprovalBasicInfoVo> getWaitApprovalBasicInfo(@RequestBody @Validated HandLawWaitApprovalQueryDto queryDto) {
        WaitApprovalBasicInfoVo vo = zszfInterfaceService.getWaitApprovalBasicInfoVo(queryDto);
        return Result.success(vo);
    }

    /**
     * 【V1.11.4】描述：获取待审批列表
     *
     * @param queryDto 查询dto
     * @return {@link Result<PageResponse<WaitApprovalRecordVo>> }
     * @author shishengyao
     * @date 2023/04/18
     */
    @PostMapping("/getWaitApprovalRecordList")
    @ApiOperation(value = "【V1.11.4】描述：获取待审批列表", httpMethod = "POST")
    public Result<PageResponse<AuditInfoListVo>> getWaitApprovalRecordList(@RequestBody @Validated HandLawWaitApprovalRecordPageQueryDto queryDto) {
        return zszfInterfaceService.getWaitApprovalRecordList(queryDto);
    }

    /**
     * 【V1.11.4】描述：查询案件催办页面
     *
     * @param handLawCaseUrgePageRequest 手案子敦促页面请求
     * @return {@link Result<PageResponse<CaseUrgePageResponse>> }
     * @author shishengyao
     * @date 2023/04/24
     */
    @PostMapping("/getCaseUrgeList")
    @ApiOperation(value = "【V1.11.4】描述：查询案件催办页面", httpMethod = "POST")
    public Result<PageResponse<CaseUrgePageResponse>> getCaseUrgeList(@RequestBody @Validated HandLawCaseUrgePageRequest handLawCaseUrgePageRequest) {
        CaseUrgePageRequest pageRequest=new CaseUrgePageRequest();
        BeanUtils.copyProperties(handLawCaseUrgePageRequest,pageRequest);
        return zszfInterfaceService.getCaseUrgePageList(pageRequest);
    }

    /**
     * 【V1.11.4】描述：保存催办 ，暂时不需要
     *
     * @param saveDto 保存dto
     * @return {@link Result<String> }
     * @author shishengyao
     * @date 2023/04/20
     */
//    @PostMapping("/saveCaseUrge")
//    @ApiOperation(value = "【V1.11.4】描述：保存催办接口", httpMethod = "POST")
//    public Result<String> saveCaseUrge(@RequestBody @Validated ZszfCaseUrgeAddDto saveDto) {
//        return zszfInterfaceService.saveCaseUrge(saveDto);
//    }

    /**
     * 【V1.11.4】描述：查询案件催办记录列表
     *
     * @param queryDto 查询dto
     * @return {@link Result<String> }
     * @author shishengyao
     * @date 2023/04/20
     */
    @PostMapping("/getUrgeDetailList")
    @ApiOperation(value = "【V1.11.4】描述：查询案件催办页面", httpMethod = "POST")
    public Result<List<CaseUrgeDetailDto>>  getUrgeDetailList(@RequestBody @Validated CaseUrgeDetailQueryDto queryDto) {
        return zszfInterfaceService.getUrgeDetailList(queryDto.getCaseId());
    }

    /**
     * 【V1.11.4】描述：查询指定数据字典列表信息
     *
     * @param queryDto 查询dto
     * @return {@link Result<String> }
     * @author shishengyao
     * @date 2023/04/20
     */
    @PostMapping("/getConfigDictionaryList")
    @ApiOperation(value = "【V1.11.4】描述：查询指定数据字典列表信息", httpMethod = "POST")
    public  Result<List<ConfigDictionaryInfoVo>>   getConfigDictionaryList(@RequestBody @Validated HandLawConfigDictionaryInfoQueryDto queryDto) {
        ConfigDictionaryInfoQueryDto dictionaryInfoQueryDto=new ConfigDictionaryInfoQueryDto();
        BeanUtils.copyProperties(queryDto,dictionaryInfoQueryDto);
        return configDictionaryInfoService.getConfigDictionaryList(dictionaryInfoQueryDto);
    }
//    /**
//     * 【V1.11.4】描述：查询案件详情
//     *
//     * @param queryDto 查询dto
//     * @return {@link Result<PageResponse<WaitApprovalRecordVo>> }
//     * @author shishengyao
//     * @date 2023/04/18
//     */
//    @PostMapping("/getCaseDetail")
//    @ApiOperation(value = "【V1.11.4】描述：查询案件详情", httpMethod = "POST")
//    public Result<PageResponse<CaseUrgePageResponse>> getCaseDetail(@RequestBody @Validated CaseUrgePageRequest queryDto) {
//        return zszfInterfaceService.getCaseUrgePageList(queryDto);
//    }
}
